package view.teacher;

import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import base.Session;
import dao.TeacherCourseDao;
import model.TeacherCourse;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;

public class ScoreEentryInterfrm extends JInternalFrame {
	private JTable table;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ScoreEentryInterfrm frame = new ScoreEentryInterfrm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ScoreEentryInterfrm() {
		setClosable(true);
		setIconifiable(true);
		setTitle("成绩录入");
		setBounds(100, 100, 856, 555);
		getContentPane().setLayout(null);

		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(47, 75, 737, 313);
		getContentPane().add(scrollPane);
		Object[][] objects = new Object[][] {  };
		
		//获取课程
		ArrayList<TeacherCourse> arrayList = TeacherCourseDao.find(Session.id);
		String[] strings = new String[arrayList.size()+2];
		strings[0] = "班级";
		strings[1] = "学号";
		strings[2] = "姓名";
		int i = 32;
		for (TeacherCourse teacherCourse : arrayList) {
			strings[i] = teacherCourse.getCou_name();
			i++;
		}
		table = new JTable();
		table.setModel(new DefaultTableModel(objects, strings));
		scrollPane.setViewportView(table);
		
		JLabel lblNewLabel = new JLabel("学生姓名：");
		lblNewLabel.setBounds(49, 33, 95, 15);
		getContentPane().add(lblNewLabel);
		
		textField = new JTextField();
		textField.setBounds(156, 30, 133, 21);
		getContentPane().add(textField);
		textField.setColumns(10);
		
		JButton btnNewButton = new JButton("查询");
		btnNewButton.setIcon(new ImageIcon(ScoreEentryInterfrm.class.getResource("/images/select.png")));
		btnNewButton.setBounds(299, 29, 93, 23);
		getContentPane().add(btnNewButton);
		
		JLabel lblNewLabel_1 = new JLabel("班级：");
		lblNewLabel_1.setBounds(511, 33, 54, 15);
		getContentPane().add(lblNewLabel_1);
		
		JComboBox comboBox = new JComboBox();
		comboBox.setBounds(615, 29, 169, 23);
		getContentPane().add(comboBox);
		
		JButton btnNewButton_1 = new JButton("保存");
		btnNewButton_1.setIcon(new ImageIcon(ScoreEentryInterfrm.class.getResource("/images/保存 (1).png")));
		btnNewButton_1.setBounds(247, 452, 130, 23);
		getContentPane().add(btnNewButton_1);
		
		JButton btnNewButton_2 = new JButton("开启自动保存");
		btnNewButton_2.setIcon(new ImageIcon(ScoreEentryInterfrm.class.getResource("/images/自动保存.png")));
		btnNewButton_2.setBounds(466, 453, 131, 23);
		getContentPane().add(btnNewButton_2);

	}
	
	private void fillTable() {
		// TODO Auto-generated method stub
		
	}
}
